function fib(n) {
    return n <= 1 ? n : fib(n - 1) + fib(n - 2);
}
var nums = [0, 1];
function fibTopBottom(n) {
    return n <= 1 ? n : nums[n] || (nums[n] = fibTopBottom(n - 1) + fibTopBottom(n - 2));
}
function fibBottomUp(n) {
    var nums = [0, 1];
    for (var i = 2; i < n; i++) {
        nums[i] = nums[i - 1] + nums[i - 2];
    }
    console.log(nums);
    return nums[n];
}
fibBottomUp(4);
